 package controlLayer;
import modelLayer.*;
import java.util.Date;
import java.util.Scanner;
public class DVDController
{
    private DvdContainer dvdCon;
    public DVDController()
    {
        dvdCon = DvdContainer.getInstance();
    }
    public void createDvd(int barcode, String title, String artist, String publictionDate, int copys)
    {
        Scanner keyboard = new Scanner(System.in);
        DVD dvd = new DVD(barcode,title,artist,publictionDate);
        dvdCon.addDVD(dvd);
        if(copys > 0)
        {
            System.out.println("enter purchaseDate");
            String purchaseDate = keyboard.next();
            System.out.println("enter purchasePrice");
            double purchasePrice = keyboard.nextInt();
            for(int i = 0; i < copys; i++)
            {
                int serialNumber = i+1;
                Copy copy = new Copy(serialNumber, purchaseDate, purchasePrice);
                dvd.addCopy(copy);
            }
        }
    }
    public void findDvd(String title)
    {
        dvdCon.findDvd(title);
    }
    public DVD findDvdforloan(String title)
    {
         return dvdCon.findDvdforloan(title);
    }
    
    public void updateDVD(String title)
    {
        dvdCon.updateDVD(title);
    }
    public void removeDvd(String title)
    {
        dvdCon.removeDvd(title);
    }
}
